from django.db import models


# Create your models here.

class TeacherModel(models.Model):
    teacher_name = models.CharField(max_length=30)
    password = models.CharField(max_length=128)
    phone = models.CharField(max_length=11)

    class Meta:
        db_table = 'teacher'

    def __str__(self):
        return self.teacher_name


class StudentModel(models.Model):
    stu_name = models.CharField(max_length=30)
    stu_sex = models.CharField(max_length=10)
    stu_icon = models.ImageField(upload_to='static/icon', verbose_name='头像')
    stu_describe = models.CharField(max_length=300, verbose_name='描述')
    teacher=models.ForeignKey(TeacherModel,on_delete=models.CASCADE,null=True)

    class Meta:
        db_table = 'student'

    def __str__(self):
        return self.stu_name
